//
//  OrderTopStepsTableViewCell.m
//  GLGW_Shoping
//
//  Created by yang on 2018/12/7.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "OrderTopStepsTableViewCell.h"

@interface StepsView ()
@property(nonatomic,strong) GLGWImageView * topImageView;
@end

@implementation StepsView{
    GLGWLabel * bottomLabel;
    //
    GLGWView * leftLineView;
    GLGWView * rightLineView;
}

- (id)initWithInSuperView:(UIView *)aSuperView
{
    if (self = [super initWithInSuperView:aSuperView]) {
        self.topImageView = [[GLGWImageView alloc] initWithImageName:@"icon_xuanzhe_zhaopian" inSuperView:self];
//        self.topImageView.backgroundColor = kRandomColor;
        [self.topImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.top.equalTo(self);
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(20)));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(20)));
        }];
        //
        leftLineView = [[GLGWView alloc] initWithInSuperView:self];
        leftLineView.backgroundColor = kColor_Rule_Yellow;
        [leftLineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self);
            make.top.equalTo(self.mas_top).offset(kHeightProportion_In_iPhoneTriploid(10));
            make.right.equalTo(self.topImageView.mas_left);
            make.height.equalTo(@1);
        }];
        //
        rightLineView = [[GLGWView alloc] initWithInSuperView:self];
        rightLineView.backgroundColor = kColor_Rule_Yellow;
        [rightLineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self);
            make.left.equalTo(self.topImageView.mas_right);
            make.top.equalTo(self.mas_top).offset(kHeightProportion_In_iPhoneTriploid(10));
            make.height.equalTo(@1);
        }];
        //
        bottomLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(10) theColor:[UIColor colorWithHexString:@"#999999"] inSuperView:self];
        bottomLabel.text = @"生成订单";
        bottomLabel.textAlignment = NSTextAlignmentCenter;
        [bottomLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.bottom.right.equalTo(self);
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(14)));
        }];
    }
    return self;
}

- (void)setTitStr:(NSString *)titStr
{
    _titStr = titStr;
    bottomLabel.text = _titStr;
}

- (void)setIndex:(int)index
{
    _index = index;
    if (_index == 0) {
        [leftLineView removeFromSuperview];
    }
    if (_index == 5) {
        [rightLineView removeFromSuperview];
    }
}

@end

@implementation OrderTopStepsTableViewCell
{
    GLGWImageView *imgVie;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        GLGWImageView *imgV = [[GLGWImageView alloc] initInSuperView:self];
        [imgV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(@(kHeightProportion_In_iPhoneTriploid(19)));
            make.left.equalTo(@(kWidthProportion_In_iPhoneTriploid(44)));
            make.right.equalTo(@(-kWidthProportion_In_iPhoneTriploid(44)));
            make.height.equalTo(@(kWidthProportion_In_iPhoneTriploid(45)));
        }];
        imgVie = imgV;
    }
    return self;
}

- (void)setDetailDataModel:(OrderInfomationDetailDataModel *)detailDataModel
{
    _detailDataModel = detailDataModel;
    if (detailDataModel.info.orderStatus >= 1 && detailDataModel.info.orderStatus <= 6) {
        NSString *str = [NSString stringWithFormat:@"icon_manyCircle%ld",detailDataModel.info.orderStatus];
        imgVie.image = [UIImage imageNamed:str];
    }
}

@end
